package com.sso.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.stereotype.Service;

import com.sso.dao.UserDao;
import com.sso.pojo.User;
import com.sso.service.UserService;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Cacheable(value = "user", key = "#userName")
    @Override
    public User findUserByUserName(String userName) {
        return userDao.findUserByUserName(userName);
    }

    @Cacheable(value = "user", key = "#id")
    @Override
    public User findUserById(int id) {
        return userDao.findUserById(id);
    }

}
